<div id="message">
	<div class="message_head">
		<%= link_to '发送短消息', :controller => :message, :action => :send_message %>
		<%= link_to '我的短消息', :controller => :message, :action => :inbox %>
	</div>
	<div>	
	    <ul>
	    	<%@length = @login_user.rmessages.select{|m| m.is_read==0}.length%>
			<%@text = @length ==0 ? "":"[#{@length}]"%>
	        <li class="active_action"><%= link_to "收件箱#{@text}", :controller => :message, :action => :inbox %></li>
	        <li class="active_action"><%= link_to "已发送", :controller => :message, :action => :outbox %></li>
			<li class="active_action"><%= link_to "垃圾箱", :controller => :message, :action => :trashbox%></li>
	    </ul>
	</div>
	<% form_tag({ :controller => :message, :action => actionbox }, :method => :post) do%>		
		<table>
			<thead>
				<tr>
					<td>选择</td>
					<td>标题</td>
					<td>发件人</td>
					<td>发送时间</td>
				</tr>
			</thead>
			<tbody>
				<%=  render :partial => 'message', :collection => @messages %>
				<tr>
					<td>
						<a href="#" onclick="$('input[name=\'delete_ids[]\']').each(function(i,s){s.checked = true;});return false;">全选</a>
						<a href="#" onclick="$('input[name=\'delete_ids[]\']').each(function(i,s){s.checked = !s.checked;});return false;">反选</a>
						<%= submit_tag "删除", :class => "choice" %>
					</td>
				</tr>
			</tbody>
		</table>
	<% end %>
</div>